class Solution {
public:
    void dfs(vector<int>& nums, vector<vector<int>>& ans, vector<int>& path, int pos, int last)
    {
        if(pos == nums.size()) 
        {
            if(path.size() > 1)
                ans.emplace_back(path);
            return;
        }
        if(nums[pos] >= last)
        {
            path.emplace_back(nums[pos]);
            dfs(nums, ans, path, pos + 1, nums[pos]);
            path.pop_back();
        }
        if(nums[pos] != last)
            dfs(nums, ans, path, pos + 1, last);
    }
    vector<vector<int>> findSubsequences(vector<int>& nums) {
        vector<vector<int>> ans;
        vector<int> path;
        dfs(nums, ans, path, 0, INT_MIN);
        return ans;
    }
};
